<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>驾校信息审核</title>
    <link href="../../layui/css/layui.css" rel="stylesheet">
    <link href="css/layuiAdmin.css" rel="stylesheet">
    <link href="../../static/css/style.css" rel="stylesheet">
    <script src="../../static/js/jquery.min.js"></script>
    <script src="../../static/js/jquery.cookie.js"></script>
    <script src="../../layui/layui.js"></script>
    <script src="../../static/js/base.js"></script>
    <script src="../../static/js/ax.js"></script>
    <script src="../../static/js/avalon.js"></script>
    <!--[if lt IE 9]>
    <script src="../../static/js/html5.js"></script>
    <script src="../../static/js/respond.js"></script>
    <![endif]-->

</head>
<body class="bg_w">

<div class="layui-card layui-fluid" ms-controller="test2">
    <div class="layui-card-body">
        <form class="layui-form" action="" lay-filter="component-form-element">
            <div class="layui-form">
                <table class="layui-table">
                    <!--<colgroup>-->
                        <!--<col width="150">-->
                        <!--<col width="150">-->
                        <!--<col width="200">-->
                        <!--<col>-->
                    <!--</colgroup>-->
                    <tbody>
                    <tr>
                        <td class="bg_h">驾校代码</td>
                        <td>{{@infolist.code}}</td>
                        <td class="bg_h">驾校名称：</td>
                        <td>{{@infolist.name}}</td>
                    </tr>
                    <tr>
                        <td class="bg_h">驾校区域</td>
                        <td>{{@infolist.region}}</td>
                        <td class="bg_h">所属管辖</td>
                        <td>{{@infolist.divisionName}}</td>
                    </tr>
                    <tr>
                        <td class="bg_h">驾校详细地址</td>
                        <td>{{@infolist.address}}</td>
                        <td class="bg_h">电子邮箱</td>
                        <td>{{@infolist.email}}</td>
                    </tr>
                    <tr>
                        <td class="bg_h">驾校联系人</td>
                        <td>{{@infolist.contacts}}</td>
                        <td class="bg_h">联系人电话</td>
                        <td>{{@infolist.mobile}}</td>
                    </tr>
                    <tr>
                        <td class="bg_h">营业执照号</td>
                        <td>{{@infolist.licensenumber}}</td>
                        <td class="bg_h">申请时间</td>
                        <td>{{@infolist.created}}</td>
                    </tr>
                    <tr>
                        <td class="bg_h">申请服务类型</td>
                        <td>{{@infolist.type}}</td>
                        <td class="bg_h">122USB-KEY</td>
                        <td>{{@infolist.usbKey}}</td>
                    </tr>
                    </tbody>
                </table>
            </div>

            <div class="drive_list" :if="@licen">
                <h5 class="lheight">营业执照</h5>
                <div class="drive_img layer-photos-demo" id="layer-photos-demo1">
                    <!--<div><p><img ms-attr="{src:@licensePics}"></p><span>点击查看大图</span></div>-->
                    <img style="width: 120px; height: 120px;margin-right: 10px;" ms-attr="{src:@el}" ms-attr="{layer-src:el}" :for="($index,el) in @licensePics">
                </div>

            </div>
            <div class="drive_list" :if="@pic">
                <h5 class="lheight">驾校图片</h5>
                <div class="drive_img layer-photos-demo" id="layer-photos-demo">

                    <!--<div :for="($index, el) in @show_pics"><p class="layer-photos-demo"><img ms-attr="{src:el}" ms-attr="{layer-src:el}"></p><span>点击查看大图</span></div>-->

                    <img :for="($index, el) in @show_pics" style="width: 120px; height: 120px;margin-right: 10px;" ms-attr="{src:el}" ms-attr="{layer-src:el}">
                </div>

            </div>
            <form>
                <div class="layui-row layui-form-pane layui-col-space15">
                    <div class="layui-form-text layui-col-xs12">
                        <label class="layui-form-label">审核结果反馈</label>
                        <div class="layui-input-block">
                            <textarea placeholder="请输入内容" name="remark" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    <div class="layui-col-sm4">
                        <label class="layui-form-label" style="width: 130px;">用户角色</label>
                        <div class="layui-input-block" style="margin-left: 130px;">
                            <select name="roleId">
                                <option value="0">请选择</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-sm4" :if="@servetype==1">
                        <label class="layui-form-label" style="width: 130px;">上级机构：总校</label>
                        <div class="layui-input-block" style="margin-left: 130px;">
                            <select name="gatherId" :duplex="@gatherId" lay-filter="branchIdSelect">
                                <option value="0">请选择</option>
                                <option :for="($index,el) in @gathertlist" ms-attr="{value:el.id}">{{el.name}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-sm4" :if="@servetype==1">
                        <label class="layui-form-label" style="width: 130px;">分校</label>
                        <div class="layui-input-block" style="margin-left: 130px;">
                            <select name="parentId" :duplex="@branchId">
                                <option value="0">请选择</option>
                                <option :for="($index,el) in @branchlist" ms-attr="{value:el.id}">{{el.name}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-sm4">
                        <label class="layui-form-label" style="width: 130px;">审核结果</label>
                        <div class="layui-input-block" style="margin-left: 130px;">
                            <select name="reviewResult">
                                <option value="">请选择</option>
                                <option value="1">审核中</option>
                                <option value="2">审核成功</option>
                                <option value="3">审核失败</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-col-space10">
                    <div class="layui-input-block">
                        <button type="button" id="btnClose" class="layui-btn layui-btn-primary btn-left">关闭</button>
                        <button class="layui-btn btn-left add_btn" lay-submit lay-filter="component-form-element">提交</button>
                    </div>
                </div>
            </form>
            <!--模板-->

        </form>
    </div>
</div>


</body>

<script>
    var vm = avalon.define({
        $id:'test2',
        pics:[],
        show_pics:[],
        infolist:{},
        select:'',
        servetype:'',
        totalschool:[],
        gathertlist:[],
        gatherId:'',
        branchlist:[],
        type:'',
        branchId:'',
        licensePics:[],
        licen:true,
        pic:true,
        //获取所有详情
        getinfo:function () {
            var data={"id":getQueryString("id")}
            console.log(data)
            ax.post({
                type: 'POST',
                url: backendWebUrl+"/api/apply/info",
                contentType: "application/x-www-form-urlencoded",
                data: data,
                success: function (res) {
                    if(res.code==0){
                        vm.infolist=res.data;
                        vm.type=res.data.type;
                        if(res.data.type==2){
                            vm.infolist.type='非直营总校';
                            vm.servetype=2;
                        }
                        if(res.data.type==1){
                            vm.infolist.type='直营总校';
                            vm.servetype=2;
                        }
                        if(res.data.type==3){
                            vm.infolist.type='分校';
                            vm.servetype=1;
                        }
                        if(res.data.type==4){
                            vm.infolist.type='报名点';
                            vm.servetype=1;
                        }
                        console.log(res.data.licensePics)

                        if(res.data.licensePics!=''){
                            var licensePics=res.data.licensePics.split(',');
                            // vm.licensePics=fileShowUrl+'?id='+res.data.licensePics;
                            for(var s in licensePics){
                                vm.licensePics.push(fileShowUrl+'?id='+licensePics[s]);

                            }
                            vm.licen=true;
                        }else {vm.licen=false;}
                        if(res.data.schoolPics!=''){
                            var pic=res.data.schoolPics.split(',');
                            for(var i in pic){
                                vm.show_pics.push(fileShowUrl+'?id='+pic[i]);
                                vm.pics.push(pic[i])
                            }
                            vm.pic=true;
                        }else {
                            vm.pic=false;
                        }

                       console.log(res.data)
                        vm.gatherId=res.data.gatherId;
                        vm.branchId=res.data.branchId;
                        vm.getGather()

                    }

                },
                error: function (request) {
                    parent.layer.msg("系统错误，联系管理员");
                }
            });
        },

        // 根据当前用户获取总校信息
        getGather:function(){
            ax.get({
                url: schoolWebUrl + '/api/gather/getTotalGather',
                contentType: "application/x-www-form-urlencoded",
                data: {  },
                success: function (r) {
                     console.log(r.data)
                    vm.gathertlist = r.data;
                    if(vm.infolist.gatherId){
                        vm.gatherId=vm.infolist.gatherId
                    }else {
                        vm.gatherId=r.data[0].id;
                    }
                    vm.getbranch();
                },
            });
        },
        //获取总校下面所有分校
        getbranch:function(){
            ax.post({
                url: schoolWebUrl + '/api/gather/getBranch',
                contentType: "application/x-www-form-urlencoded",
                data: {"gatherId":vm.gatherId},
                success: function (r) {
                    console.log(r)
                    vm.branchlist = r.data;
                    if(vm.infolist.branchId!='0'){
                        vm.branchId=vm.infolist.branchId
                    }else {
                        vm.branchId='0'
                    }
                    setTimeout(function () {
                        form.render('select');
                    },200)
                },
            });
        }
    });
    vm.$watch('onReady', function () {
        vm.getinfo();
        vm.getGather();
    });

$('.drive_img>div').click(function () {
    $(this).toggleClass('maximg');
})
    var form;
  layui.use(['table','layer'], function() {
      form=layui.form;
      var  layer=layui.layer;
      form.on('submit(component-form-element)', function (data) {
          data.field.id=getQueryString("id");

          ax.post({
              url: backendWebUrl + "/api/apply/reviewApply",
              data: data.field,
              contentType: "application/x-www-form-urlencoded",
              success: function (data) {
                  layer.msg(data.message);
                  if (data.code == 0) {
                      //刷新父页面

                      parent.location.reload();
                      layer.closeAll("iframe");
                  } else {

                  }
              }
          });
          return false;
      });
      // 总校改变
      form.on('select(branchIdSelect)', function (data) {
          console.log(111)
          vm.gatherId = data.value;
          vm.getbranch();
      });
      $('#btnClose').on("click", function () {
          parent.layer.close(parent.layer.getFrameIndex(window.name));
      });
  //点击查看大图
      layer.photos({
          photos: '#layer-photos-demo'
          ,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
      });
      layer.photos({
          photos: '#layer-photos-demo1'
          ,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
      });
  })



</script>
</html>